package com.example.freemarkdemo.freemarker;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.ArrayList;
import java.util.List;

@Controller
@RequestMapping("/index")
public class FreeMarkerController {
    @RequestMapping(value = "/freemarker",method = RequestMethod.GET)
    public String welcomeFreeMarker(Model model){
        model.addAttribute("name","老司机");
        return "freemarkerdemo";
    }
    @RequestMapping(value = "/login",method = RequestMethod.GET)
    public String login(Model model){
        List<String> userList = new ArrayList<>();
        userList.add("周笔畅");
        userList.add("李宇春");
        userList.add("张靓颖");
        model.addAttribute("userList",userList);
        return "index";
    }
}
